<!--
 * @Description: 
 * @Version: 2.0
 * @Autor: zhangjx
 * @Date: 2023-05-25 14:26:55
 * @LastEditors: uphldjx 1373577124@qq.com
 * @LastEditTime: 2023-10-19 11:31:19
-->
<template>
	<div class="login-wrapper">
		<div class="login-title">
			<span>"宁享养老"综合信息平台</span>
		</div>
		<div class="login-content">
			<div class="login-right">
				<LoginForm class="login-form" @submit="onSubmit"></LoginForm>
			</div>
			<div class="login-footer">
				<p>版权：南京市民政局</p>
				<p class="operation_unit">运营单位:南京市养老服务质量指导中心</p>
				<p>技术支持:<el-link href="https://www.aplid.com/" target="_blank"> 南京市爱普雷德电子科技有限公司 </el-link></p>
			</div>
		</div>
	</div>
</template>

<script setup lang="ts">
import LoginForm from './LoginForm.vue'
import { useUserStore } from '@/stores/user'
import { ElLoading } from 'element-plus'

const router = useRouter()
const { userLogin } = useUserStore()

const spinning = ref(false)
const onSubmit = (val) => {
	spinning.value = true
	const loading = ElLoading.service({
		lock: true,
		text: '验证成功,正在初始化中',
		background: 'rgba(0, 0, 0, 0.6)',
	})
	userLogin(val, 'account').then((res) => {
		router.push('/')
		loading.close()
	}).catch(()=> {
    loading.close()
  })
}
</script>

<style scoped lang="scss">
@import '@/styles/scss/login.scss';
</style>
